package cn.itmantzy.basic.util;

import lombok.Data;

@Data
public class AjaxResult {
    // 设置初始化值，默认操作成功
    private Boolean success = true;
    private String message = "操作成功!";
    private Object resultObj;

    /**
     * 获取AjaxResult实例
     * @return
     */
    public static AjaxResult getAjaxResult(){
        return new AjaxResult();
    }

    /**
     * 出现异常时，将success设置为false
     * @param success
     * @return
     */
    public AjaxResult setSuccess(Boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    public AjaxResult setResultObj(Object resultObj){
        this.resultObj = resultObj;
        return this;
    }

}
